package GUI;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

import Listeners.AssignReviewerListener;
import Listeners.RemovePaperListener;
import Listeners.UploadRecommendationListener;
import Model.Conference;
import Model.Paper;
import Model.User;

/**
 * Panel that displays a paper associated with a Subprogram Chair.
 * 
 * @author William Kim
 * @version 11/27/2012 Reused Paul Schultz code from PaperPanel.java
 */
@SuppressWarnings("serial")
public class SPCPaperPanel extends JPanel
{

  public SPCPaperPanel(final Paper the_paper, final Conference the_conf,
      final User the_user, final ConferenceWizardFrame the_frame)
  {
    super();
    this.setAlignmentX(LEFT_ALIGNMENT);
    GridLayout gLayout = new GridLayout(0, 2);
    // gLayout.setHgap(80);
    this.setLayout(gLayout);
    JLabel titleLabel = new JLabel("Title: " + the_paper.getTitle());
    titleLabel.setFont(new Font("Plain", Font.PLAIN, 18));
    titleLabel.setAlignmentX(LEFT_ALIGNMENT);

    JLabel authorLabel = new JLabel("Author: "
        + the_paper.getAuthor().realName());
    authorLabel.setFont(new Font("Plain", Font.PLAIN, 16));
    authorLabel.setForeground(new Color(0, 0, 102));

    // TODO make buttons/listeners for assigning reviewers
    JPanel button_panel = new JPanel();
    JButton submitRec = new JButton("Submit Recommendation");
    button_panel.setLayout(new FlowLayout(FlowLayout.TRAILING));
    button_panel.add(submitRec);
    submitRec.addActionListener(new UploadRecommendationListener(the_paper));

    JPanel button_panel2 = new JPanel();
    JButton assignPaper = new JButton("Assign Reviewer");
    assignPaper.addActionListener(new AssignReviewerListener(the_conf,
        the_paper, the_user, the_frame, the_user));

    button_panel2.setLayout(new FlowLayout(FlowLayout.TRAILING));
    button_panel2.add(assignPaper);
    button_panel.setAlignmentY(RIGHT_ALIGNMENT);
    this.add(titleLabel);
    this.add(button_panel);
    this.add(authorLabel);
    this.add(button_panel2);

    // this.setPreferredSize();
    this.setMaximumSize(new Dimension(750, 80));
    this.setBorder(BorderFactory.createLineBorder(Color.BLACK));

  }
}
